#version 1.0.1
import datetime
class memobee_note:
	def __init__(self,id='0',title='',date='',body=''):
		
		# to put new id if it's not set
		if id =='0' or id == 0 or id =='':
			id_obj = datetime.datetime.today()
			id_text = str(id_obj).replace(' ','').replace('-','').replace(':','').replace('.','')
			self.id = id_text
		else:
			self.id = id
			
		if title=='' or title==None:
			title = ' '
		self.title = str(title)
		
		# to put the date = now if not set
		if date == '':
			date = datetime.datetime.today()
			
		#to convert the date of it's a string into a date instance
		if date.__class__ == str:
			self.date = datetime.datetime.strptime(date,'%Y-%m-%d %H:%M:%S')
		else:
			date = datetime.datetime(date.year,date.month,date.day,date.hour,date.minute,date.second)
			self.date = date
			
		if body=='' or body==None:
			body = ' '
		self.body = str(body)
		
	def add(self, fman):
		fman.add_note(self)
	
	def edit(self, fman):
		fman.edit_note(self.id, self)
	
	def delete(self, fman):
		fman.del_note(self.id)
	
	def past(self):
		now_date = datetime.datetime.today()
		time_delta = now_date-self.date
		if time_delta.days <0:
			return False
		else:
			return True
		
		
class memobee_launcher:
	def __init__(self,id='0',date='',command='',terminal='0'):
		
		#putting an id if not set
		if id =='0' or id == 0 or id == '' :
			id_obj = datetime.datetime.today()
			id_text = str(id_obj).replace(' ','').replace('-','').replace(':','').replace('.','')
			self.id = id_text
		else:
			self.id = id
		
		# to put the date = now if not set
		if date == '':
			date = datetime.datetime.today()
			
		#to convert the date of it's a string into a date instance
		if date.__class__ == str:
			self.date = datetime.datetime.strptime(date,'%Y-%m-%d %H:%M:%S')
		else:
			date = datetime.datetime(date.year,date.month,date.day,date.hour,date.minute,date.second)
			self.date = date
		
		if command=='' or command==None:
			command = ' '	
		self.command = str(command)
		
		self.terminal = bool(int(terminal))
	
	def add(self, fman):
		fman.add_launcher(self)
	
	def edit(self, fman):
		fman.edit_launcher(self.id, self)
	
	def delete(self, fman):
		fman.del_launcher(self.id)
		
	def past(self):
		now_date = datetime.datetime.today()
		time_delta = now_date-self.date
		print time_delta.days
		if time_delta.days <0:
			return False
		else:
			return True